<?php
    function getStockQuote($symbol) {

        mysql_connect('server','user','pass');
        mysql_select_db('test');
        $query = "SELECT stock_price FROM stockprices "
               . "WHERE stock_symbol = '$symbol'";
        $result = mysql_query($query);

        $row = mysql_fetch_assoc($result);
        return $row['stock_price'];
    }

   
     require_once "../lib/nusoap/lib/nusoap.php";

    $server = new soap_server();

    $server->configureWSDL('stockserver', 'urn:stockquote');

    $server->register("getStockQuote",
                    array('symbol' => 'xsd:string'),
                    array('return' => 'xsd:decimal'),
                    'urn:stockquote',
                    'urn:stockquote#getStockQuote');

    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)
                          ? $HTTP_RAW_POST_DATA : '';
    $server->service($HTTP_RAW_POST_DATA);
?>
